/*
 * Copyright (c) 2013-2020, tanghailan (tanghailan@88.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.kanavi.redisson.business.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kanavi.redisson.business.entity.BatchOrder;
import com.kanavi.redisson.business.entity.BatchOrderParam;
import com.kanavi.redisson.business.mapper.BatchOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * <b>RemoteServiceCall.java</b></br>
 *
 * <pre></pre>
 *
 * @author tanghailan tanghailan@88.com
 * @date 2021年03月27日 23:54:07
 * @since JDK 1.8
 */
@Service
public class RemoteServiceCall {
    @Autowired
    private BatchOrderMapper batchOrderMapper;

    public Map<String, Object> queryOrderInfoByCode(String orderCode) {
        return null;
    }

    public List<BatchOrder> queryOrderInfoByCodeBatch(List<BatchOrderParam> params) {
        List<BatchOrder> result = new ArrayList<>();
        for (BatchOrderParam param : params) {
            LambdaQueryWrapper<BatchOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
            lambdaQueryWrapper.eq(BatchOrder::getOrderCode, param.getOrderCode());
            BatchOrder batchOrder = batchOrderMapper.selectOne(lambdaQueryWrapper);
            result.add(batchOrder);
        }
        return result;
    }
}
